/*     */ package com.zimbra.cs.service.mail;
/*     */ 
/*     */ import com.zimbra.common.account.Key.AccountBy;
/*     */ import com.zimbra.common.account.Key.CosBy;
/*     */ import com.zimbra.common.account.Key.DistributionListBy;
/*     */ import com.zimbra.common.account.Key.DomainBy;
/*     */ import com.zimbra.common.mime.InternetAddress;
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.common.soap.Element;
/*     */ import com.zimbra.cs.account.Account;
/*     */ import com.zimbra.cs.account.AccountServiceException;
/*     */ import com.zimbra.cs.account.Domain;
/*     */ import com.zimbra.cs.account.Group;
/*     */ import com.zimbra.cs.account.MailTarget;
/*     */ import com.zimbra.cs.account.NamedEntry;
/*     */ import com.zimbra.cs.account.Provisioning;
/*     */ import com.zimbra.cs.account.SearchDirectoryOptions;
/*     */ import com.zimbra.cs.account.SearchDirectoryOptions.ObjectType;
/*     */ import com.zimbra.cs.fb.FreeBusyProvider;
/*     */ import com.zimbra.cs.ldap.ZLdapFilterFactory.FilterId;
/*     */ import com.zimbra.cs.mailbox.ACL;
/*     */ import com.zimbra.cs.mailbox.ACL.Grant;
/*     */ import com.zimbra.cs.mailbox.Flag;
/*     */ import com.zimbra.cs.mailbox.Flag.FlagInfo;
/*     */ import com.zimbra.cs.mailbox.Folder;
/*     */ import com.zimbra.cs.mailbox.MailItem.Type;
/*     */ import com.zimbra.cs.mailbox.Mailbox;
/*     */ import com.zimbra.cs.mailbox.Mailbox.FolderNode;
/*     */ import com.zimbra.cs.mailbox.OperationContext;
/*     */ import com.zimbra.cs.service.util.ItemId;
/*     */ import com.zimbra.cs.service.util.ItemIdFormatter;
/*     */ import com.zimbra.cs.util.AccountUtil;
/*     */ import com.zimbra.soap.ZimbraSoapContext;
/*     */ import com.zimbra.soap.mail.type.RetentionPolicy;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ 
/*     */ public class FolderAction extends ItemAction
/*     */ {
/*     */   public static final String OP_EMPTY = "empty";
/*     */   public static final String OP_REFRESH = "sync";
/*     */   public static final String OP_FREEBUSY = "fb";
/*     */   public static final String OP_CHECK = "check";
/*     */   public static final String OP_UNCHECK = "!check";
/*     */   public static final String OP_SET_URL = "url";
/*     */   public static final String OP_IMPORT = "import";
/*     */   public static final String OP_GRANT = "grant";
/*     */   public static final String OP_REVOKE = "!grant";
/*     */   public static final String OP_REVOKEORPHANGRANTS = "revokeorphangrants";
/*     */   public static final String OP_UNFLAG = "!flag";
/*     */   public static final String OP_UNTAG = "!tag";
/*     */   public static final String OP_SYNCON = "syncon";
/*     */   public static final String OP_SYNCOFF = "!syncon";
/*     */   public static final String OP_RETENTIONPOLICY = "retentionpolicy";
/*     */   public static final String OP_DISABLE_ACTIVESYNC = "disableactivesync";
/*     */   public static final String OP_ENABLE_ACTIVESYNC = "!disableactivesync";
/*     */   public static final String OP_WEBOFFLINESYNCDAYS = "webofflinesyncdays";
/*     */   
/*     */   protected String[] getProxiedIdPath(Element request)
/*     */   {
/*  62 */     String operation = getXPath(request, OPERATION_PATH);
/*  63 */     if ((operation != null) && (FOLDER_OPS.contains(operation.toLowerCase())))
/*  64 */       return TARGET_ITEM_PATH;
/*  65 */     return super.getProxiedIdPath(request);
/*     */   }
/*     */   
/*  68 */   protected boolean checkMountpointProxy(Element request) { String operation = getXPath(request, OPERATION_PATH);
/*     */     
/*  70 */     if (("grant".equalsIgnoreCase(operation)) || ("!grant".equalsIgnoreCase(operation)) || ("revokeorphangrants".equalsIgnoreCase(operation)))
/*     */     {
/*  72 */       return true; }
/*  73 */     return super.checkMountpointProxy(request);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*  96 */   private static final Set<String> FOLDER_OPS = com.google.common.collect.ImmutableSet.of("empty", "sync", "url", "import", "fb", "check", new String[] { "!check", "grant", "!grant", "revokeorphangrants", "update", "syncon", "!syncon", "retentionpolicy", "disableactivesync", "!disableactivesync", "webofflinesyncdays" });
/*     */   
/*     */ 
/*     */ 
/*     */   public Element handle(Element request, Map<String, Object> context)
/*     */     throws ServiceException
/*     */   {
/* 103 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/*     */     
/* 105 */     Element action = request.getElement("action");
/* 106 */     String operation = action.getAttribute("op").toLowerCase();
/*     */     
/* 108 */     Element response = zsc.createElement(com.zimbra.common.soap.MailConstants.FOLDER_ACTION_RESPONSE);
/* 109 */     Element result = response.addUniqueElement("action");
/*     */     
/* 111 */     if ((operation.equals("tag")) || (operation.equals("flag")) || (operation.equals("!tag")) || (operation.equals("!flag")))
/* 112 */       throw ServiceException.INVALID_REQUEST("cannot tag/flag a folder", null);
/* 113 */     if ((operation.endsWith("copy")) || (operation.endsWith("spam"))) {
/* 114 */       throw ServiceException.INVALID_REQUEST("invalid operation on folder: " + operation, null);
/*     */     }
/*     */     String successes;
/*     */     String successes;
/* 118 */     if (FOLDER_OPS.contains(operation)) {
/* 119 */       successes = handleFolder(context, request, operation, result);
/*     */     } else {
/* 121 */       successes = handleCommon(context, request, operation, MailItem.Type.FOLDER);
/*     */     }
/* 123 */     result.addAttribute("id", successes);
/* 124 */     result.addAttribute("op", operation);
/* 125 */     return response;
/*     */   }
/*     */   
/*     */   private String handleFolder(Map<String, Object> context, Element request, String operation, Element result) throws ServiceException
/*     */   {
/* 130 */     Element action = request.getElement("action");
/*     */     
/* 132 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 133 */     Mailbox mbox = getRequestedMailbox(zsc);
/* 134 */     OperationContext octxt = getOperationContext(zsc, context);
/* 135 */     ItemIdFormatter ifmt = new ItemIdFormatter(zsc);
/* 136 */     ItemId iid = new ItemId(action.getAttribute("id"), zsc);
/*     */     
/* 138 */     if (operation.equals("empty")) {
/* 139 */       boolean subfolders = action.getAttributeBool("recursive", true);
/* 140 */       mbox.emptyFolder(octxt, iid.getId(), subfolders);
/*     */       
/* 142 */       if (iid.getId() == 3)
/* 143 */         mbox.purgeImapDeleted(octxt);
/* 144 */     } else if (operation.equals("sync")) {
/* 145 */       mbox.synchronizeFolder(octxt, iid.getId());
/* 146 */     } else if (operation.equals("import")) {
/* 147 */       String url = action.getAttribute("url");
/* 148 */       mbox.importFeed(octxt, iid.getId(), url, false);
/* 149 */     } else if (operation.equals("fb")) {
/* 150 */       boolean fb = action.getAttributeBool("excludeFreeBusy", false);
/* 151 */       mbox.alterTag(octxt, iid.getId(), MailItem.Type.FOLDER, Flag.FlagInfo.EXCLUDE_FREEBUSY, fb, null);
/* 152 */       FreeBusyProvider.mailboxChanged(zsc.getRequestedAccountId());
/* 153 */     } else if ((operation.equals("check")) || (operation.equals("!check"))) {
/* 154 */       mbox.alterTag(octxt, iid.getId(), MailItem.Type.FOLDER, Flag.FlagInfo.CHECKED, operation.equals("check"), null);
/* 155 */     } else if (operation.equals("url")) {
/* 156 */       String url = action.getAttribute("url", "");
/* 157 */       mbox.setFolderUrl(octxt, iid.getId(), url);
/* 158 */       if (!url.equals("")) {
/* 159 */         mbox.synchronizeFolder(octxt, iid.getId());
/*     */       }
/* 161 */       if (action.getAttribute("excludeFreeBusy", null) != null) {
/* 162 */         boolean fb = action.getAttributeBool("excludeFreeBusy", false);
/* 163 */         mbox.alterTag(octxt, iid.getId(), MailItem.Type.FOLDER, Flag.FlagInfo.EXCLUDE_FREEBUSY, fb, null);
/*     */       }
/* 165 */     } else if (operation.equals("!grant")) {
/* 166 */       String zid = action.getAttribute("zid");
/* 167 */       mbox.revokeAccess(octxt, iid.getId(), zid);
/* 168 */     } else if (operation.equals("grant")) {
/* 169 */       Element grant = action.getElement("grant");
/* 170 */       short rights = ACL.stringToRights(grant.getAttribute("perm"));
/* 171 */       byte gtype = ACL.stringToType(grant.getAttribute("gt"));
/* 172 */       String zid = grant.getAttribute("zid", null);
/* 173 */       long expiry = grant.getAttributeLong("expiry", 0L);
/* 174 */       String secret = null;
/* 175 */       NamedEntry nentry = null;
/* 176 */       if (gtype == 3) {
/* 177 */         zid = "00000000-0000-0000-0000-000000000000";
/* 178 */       } else if (gtype == 6) {
/* 179 */         zid = "99999999-9999-9999-9999-999999999999";
/* 180 */         expiry = validateGrantExpiry(grant.getAttribute("expiry", null), AccountUtil.getMaxPublicShareLifetime(mbox.getAccount(), mbox.getFolderById(octxt, iid.getId()).getDefaultView()));
/*     */       }
/* 182 */       else if (gtype == 7) {
/* 183 */         zid = grant.getAttribute("d");
/* 184 */         if ((zid == null) || (zid.indexOf('@') < 0)) {
/* 185 */           throw ServiceException.INVALID_REQUEST("invalid guest id or password", null);
/*     */         }
/* 187 */         boolean guestGrantee = true;
/*     */         try {
/* 189 */           nentry = lookupGranteeByName(zid, (byte)1, zsc);
/* 190 */           if ((nentry instanceof MailTarget)) {
/* 191 */             Domain domain = Provisioning.getInstance().getDomain(mbox.getAccount());
/* 192 */             String granteeDomainName = ((MailTarget)nentry).getDomainName();
/* 193 */             if ((domain.isInternalSharingCrossDomainEnabled()) || (domain.getName().equals(granteeDomainName)) || (com.google.common.collect.Sets.newHashSet(domain.getInternalSharingDomain()).contains(granteeDomainName)))
/*     */             {
/*     */ 
/* 196 */               guestGrantee = false;
/* 197 */               zid = nentry.getId();
/* 198 */               gtype = (nentry instanceof Group) ? 2 : 1;
/*     */             }
/*     */           }
/*     */         }
/*     */         catch (ServiceException e) {}
/*     */         
/* 204 */         if (guestGrantee) {
/* 205 */           secret = grant.getAttribute("args", null);
/*     */           
/* 207 */           if (secret == null) {
/* 208 */             secret = grant.getAttribute("pw", null);
/*     */           }
/*     */         }
/* 211 */       } else if (gtype == 8) {
/* 212 */         zid = grant.getAttribute("d");
/*     */         
/*     */ 
/*     */ 
/* 216 */         secret = grant.getAttribute("key", null);
/* 217 */       } else if (zid != null) {
/* 218 */         nentry = lookupGranteeByZimbraId(zid, gtype);
/*     */       } else {
/*     */         try {
/* 221 */           nentry = lookupGranteeByName(grant.getAttribute("d"), gtype, zsc);
/* 222 */           zid = nentry.getId();
/*     */           
/* 224 */           if ((gtype == 1) && ((nentry instanceof Group))) {
/* 225 */             gtype = 2;
/*     */           }
/*     */         } catch (ServiceException e) {
/* 228 */           if ("account.NO_SUCH_ACCOUNT".equals(e.getCode()))
/*     */           {
/*     */ 
/* 231 */             gtype = 7;
/* 232 */             zid = grant.getAttribute("d");
/*     */           } else {
/* 234 */             throw e;
/*     */           }
/*     */         }
/*     */       }
/*     */       
/* 239 */       ACL.Grant g = mbox.grantAccess(octxt, iid.getId(), zid, gtype, rights, secret, expiry);
/*     */       
/*     */ 
/* 242 */       result.addAttribute("zid", zid);
/* 243 */       if (nentry != null) {
/* 244 */         result.addAttribute("d", nentry.getName());
/* 245 */       } else if ((gtype == 7) || (gtype == 8))
/* 246 */         result.addAttribute("d", zid);
/* 247 */       if (gtype == 8)
/* 248 */         result.addAttribute("key", g.getPassword());
/* 249 */     } else if (operation.equals("revokeorphangrants")) {
/* 250 */       String zid = action.getAttribute("zid");
/* 251 */       byte gtype = ACL.stringToType(action.getAttribute("gt"));
/* 252 */       revokeOrphanGrants(octxt, mbox, iid, zid, gtype);
/* 253 */     } else if (operation.equals("update"))
/*     */     {
/* 255 */       String newName = action.getAttribute("name", null);
/* 256 */       String folderId = action.getAttribute("l", null);
/* 257 */       ItemId iidFolder = new ItemId(folderId == null ? "-1" : folderId, zsc);
/* 258 */       if (!iidFolder.belongsTo(mbox))
/* 259 */         throw ServiceException.INVALID_REQUEST("cannot move folder between mailboxes", null);
/* 260 */       if ((folderId != null) && (iidFolder.getId() <= 0)) {
/* 261 */         throw com.zimbra.cs.mailbox.MailServiceException.NO_SUCH_FOLDER(iidFolder.getId());
/*     */       }
/* 263 */       String flags = action.getAttribute("f", null);
/* 264 */       byte color = (byte)(int)action.getAttributeLong("color", -1L);
/* 265 */       String view = action.getAttribute("view", null);
/* 266 */       Element eAcl = action.getOptionalElement("acl");
/* 267 */       ACL acl = null;
/* 268 */       if (eAcl != null) {
/* 269 */         acl = parseACL(eAcl, view == null ? mbox.getFolderById(octxt, iid.getId()).getDefaultView() : MailItem.Type.of(view), mbox.getAccount());
/*     */       }
/*     */       
/*     */ 
/* 273 */       if (color >= 0) {
/* 274 */         mbox.setColor(octxt, iid.getId(), MailItem.Type.FOLDER, color);
/*     */       }
/* 276 */       if (acl != null) {
/* 277 */         mbox.setPermissions(octxt, iid.getId(), acl);
/*     */       }
/* 279 */       if (flags != null) {
/* 280 */         mbox.setTags(octxt, iid.getId(), MailItem.Type.FOLDER, Flag.toBitmask(flags), null, null);
/*     */       }
/* 282 */       if (view != null) {
/* 283 */         mbox.setFolderDefaultView(octxt, iid.getId(), MailItem.Type.of(view));
/*     */       }
/* 285 */       if (newName != null) {
/* 286 */         mbox.rename(octxt, iid.getId(), MailItem.Type.FOLDER, newName, iidFolder.getId());
/* 287 */       } else if (iidFolder.getId() > 0) {
/* 288 */         mbox.move(octxt, iid.getId(), MailItem.Type.FOLDER, iidFolder.getId(), null);
/*     */       }
/* 290 */     } else if ((operation.equals("syncon")) || (operation.equals("!syncon"))) {
/* 291 */       mbox.alterTag(octxt, iid.getId(), MailItem.Type.FOLDER, Flag.FlagInfo.SYNC, operation.equals("syncon"), null);
/* 292 */     } else if (operation.equals("retentionpolicy")) {
/* 293 */       mbox.setRetentionPolicy(octxt, iid.getId(), MailItem.Type.FOLDER, new RetentionPolicy(action.getElement("retentionPolicy")));
/*     */     }
/* 295 */     else if ((operation.equals("disableactivesync")) || (operation.equals("!disableactivesync"))) {
/* 296 */       mbox.setActiveSyncDisabled(octxt, iid.getId(), operation.equals("disableactivesync"));
/* 297 */     } else if (operation.equals("webofflinesyncdays")) {
/* 298 */       mbox.setFolderWebOfflineSyncDays(octxt, iid.getId(), action.getAttributeInt("numDays"));
/*     */     }
/*     */     else {
/* 301 */       throw ServiceException.INVALID_REQUEST("unknown operation: " + operation, null);
/*     */     }
/*     */     
/* 304 */     return ifmt.formatItemId(iid);
/*     */   }
/*     */   
/*     */   static ACL parseACL(Element eAcl, MailItem.Type folderType, Account account) throws ServiceException {
/* 308 */     if (eAcl == null) {
/* 309 */       return null;
/*     */     }
/* 311 */     long internalGrantExpiry = validateGrantExpiry(eAcl.getAttribute("internalGrantExpiry", null), AccountUtil.getMaxInternalShareLifetime(account, folderType));
/*     */     
/* 313 */     long guestGrantExpiry = validateGrantExpiry(eAcl.getAttribute("guestGrantExpiry", null), AccountUtil.getMaxExternalShareLifetime(account, folderType));
/*     */     
/* 315 */     ACL acl = new ACL(internalGrantExpiry, guestGrantExpiry);
/*     */     
/* 317 */     for (Element grant : eAcl.listElements("grant")) {
/* 318 */       String zid = grant.getAttribute("zid");
/* 319 */       byte gtype = ACL.stringToType(grant.getAttribute("gt"));
/* 320 */       short rights = ACL.stringToRights(grant.getAttribute("perm"));
/* 321 */       long expiry = gtype == 6 ? validateGrantExpiry(grant.getAttribute("expiry", null), AccountUtil.getMaxPublicShareLifetime(account, folderType)) : grant.getAttributeLong("expiry", 0L);
/*     */       
/*     */ 
/*     */ 
/*     */ 
/* 326 */       String secret = null;
/* 327 */       if (gtype == 8) {
/* 328 */         secret = grant.getAttribute("key", null);
/* 329 */       } else if (gtype == 7) {
/* 330 */         secret = grant.getAttribute("args", null);
/*     */         
/* 332 */         if (secret == null) {
/* 333 */           secret = grant.getAttribute("pw", null);
/*     */         }
/*     */       }
/* 336 */       acl.grantAccess(zid, gtype, rights, secret, expiry);
/*     */     }
/* 338 */     return acl;
/*     */   }
/*     */   
/*     */   public static NamedEntry lookupEmailAddress(String name) throws ServiceException {
/* 342 */     if (name.indexOf('<') > 0) {
/* 343 */       InternetAddress addr = new InternetAddress(name);
/* 344 */       name = addr.getAddress();
/*     */     }
/* 346 */     Provisioning prov = Provisioning.getInstance();
/* 347 */     NamedEntry nentry = prov.get(Key.AccountBy.name, name);
/* 348 */     if (nentry == null) {
/* 349 */       nentry = prov.getGroup(Key.DistributionListBy.name, name);
/*     */     }
/* 351 */     return nentry;
/*     */   }
/*     */   
/*     */   static NamedEntry lookupGranteeByName(String name, byte type, ZimbraSoapContext zsc) throws ServiceException {
/* 355 */     if ((type == 3) || (type == 6) || (type == 7) || (type == 8)) {
/* 356 */       return null;
/*     */     }
/* 358 */     Provisioning prov = Provisioning.getInstance();
/*     */     
/* 360 */     if (((type == 1) || (type == 2)) && (name.indexOf('@') == -1)) {
/* 361 */       Account authacct = prov.get(Key.AccountBy.id, zsc.getAuthtokenAccountId(), zsc.getAuthToken());
/* 362 */       String authname = authacct == null ? null : authacct.getName();
/* 363 */       if (authacct != null) {
/* 364 */         name = name + authname.substring(authname.indexOf('@'));
/*     */       }
/*     */     }
/* 367 */     NamedEntry nentry = null;
/* 368 */     if (name != null) {
/* 369 */       switch (type) {
/* 370 */       case 5:  nentry = prov.get(Key.CosBy.name, name); break;
/* 371 */       case 4:  nentry = prov.get(Key.DomainBy.name, name); break;
/* 372 */       case 1:  nentry = lookupEmailAddress(name); break;
/* 373 */       case 2:  nentry = prov.getGroup(Key.DistributionListBy.name, name);
/*     */       }
/*     */     }
/* 376 */     if (nentry != null)
/* 377 */       return nentry;
/* 378 */     switch (type) {
/* 379 */     case 5:  throw AccountServiceException.NO_SUCH_COS(name);
/* 380 */     case 4:  throw AccountServiceException.NO_SUCH_DOMAIN(name);
/* 381 */     case 1:  throw AccountServiceException.NO_SUCH_ACCOUNT(name);
/* 382 */     case 2:  throw AccountServiceException.NO_SUCH_DISTRIBUTION_LIST(name); }
/* 383 */     throw ServiceException.FAILURE("LDAP entry not found for " + name + " : " + type, null);
/*     */   }
/*     */   
/*     */   public static NamedEntry lookupGranteeByZimbraId(String zid, byte type)
/*     */   {
/* 388 */     Provisioning prov = Provisioning.getInstance();
/*     */     try {
/* 390 */       switch (type) {
/* 391 */       case 5:  return prov.get(Key.CosBy.id, zid);
/* 392 */       case 4:  return prov.get(Key.DomainBy.id, zid);
/* 393 */       case 1:  return prov.get(Key.AccountBy.id, zid);
/* 394 */       case 2:  return prov.getGroup(Key.DistributionListBy.id, zid);
/*     */       }
/*     */       
/*     */       
/*     */ 
/* 399 */       return null;
/*     */     }
/*     */     catch (ServiceException e) {}
/* 402 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */   private void revokeOrphanGrants(OperationContext octxt, Mailbox mbox, ItemId iid, String granteeId, byte gtype)
/*     */     throws ServiceException
/*     */   {
/* 409 */     SearchDirectoryOptions opts = new SearchDirectoryOptions();
/* 410 */     if (gtype == 1) {
/* 411 */       opts.addType(SearchDirectoryOptions.ObjectType.accounts);
/* 412 */       opts.addType(SearchDirectoryOptions.ObjectType.resources);
/* 413 */     } else if (gtype == 2) {
/* 414 */       opts.addType(SearchDirectoryOptions.ObjectType.distributionlists);
/* 415 */     } else if (gtype == 5) {
/* 416 */       opts.addType(SearchDirectoryOptions.ObjectType.coses);
/* 417 */     } else if (gtype == 4) {
/* 418 */       opts.addType(SearchDirectoryOptions.ObjectType.domains);
/*     */     } else {
/* 420 */       throw ServiceException.INVALID_REQUEST("invalid grantee type for revokeOrphanGrants", null);
/*     */     }
/*     */     
/* 423 */     String query = "(zimbraId=" + granteeId + ")";
/* 424 */     opts.setFilterString(ZLdapFilterFactory.FilterId.SEARCH_GRANTEE, query);
/* 425 */     opts.setOnMaster(true);
/* 426 */     List<NamedEntry> entries = Provisioning.getInstance().searchDirectory(opts);
/*     */     
/* 428 */     if (entries.size() != 0) {
/* 429 */       throw ServiceException.INVALID_REQUEST("grantee " + granteeId + " exists", null);
/*     */     }
/*     */     
/*     */ 
/*     */ 
/* 434 */     Mailbox.FolderNode rootNode = mbox.getFolderTree(octxt, iid, true);
/* 435 */     revokeOrphanGrants(octxt, mbox, rootNode, granteeId, gtype);
/*     */   }
/*     */   
/*     */   private void revokeOrphanGrants(OperationContext octxt, Mailbox mbox, Mailbox.FolderNode node, String granteeId, byte gtype) throws ServiceException
/*     */   {
/* 440 */     if (node.mFolder != null)
/*     */     {
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/* 452 */       boolean canAdmin = (mbox.getEffectivePermissions(octxt, node.mFolder.getId(), MailItem.Type.FOLDER) & 0x100) != 0;
/*     */       
/* 454 */       if (canAdmin) {
/* 455 */         ACL acl = node.mFolder.getACL();
/* 456 */         if (acl != null) {
/* 457 */           for (ACL.Grant grant : acl.getGrants()) {
/* 458 */             if ((granteeId.equals(grant.getGranteeId())) && (gtype == grant.getGranteeType())) {
/* 459 */               mbox.revokeAccess(octxt, node.mFolder.getId(), granteeId);
/*     */               
/* 461 */               break;
/*     */             }
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */     
/* 468 */     for (Mailbox.FolderNode subNode : node.mSubfolders) {
/* 469 */       revokeOrphanGrants(octxt, mbox, subNode, granteeId, gtype);
/*     */     }
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/FolderAction.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */